package com.blackitheima1.polymorphic.test2;

public class TestPolymorphic {
    public static void main(String[] args) {
        //创建多态
        Fu f=new Zi();
        System.out.println(f.num);  //成员变量编译看左(父),运行看左(父)
        f.show();            //成员方法编译看左(父),运行看右(子)
    }
}

//父类
class Fu{
    int num=10;
    public void show(){
        System.out.println("我是父类");
    }
}
class Zi extends Fu{
    int num=20;
    public void show(){
        System.out.println("我是子类");
    }
}